package cn.iocoder.yudao.module.contract.controller.admin.orderContract.vo;

import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.contract.utils.StringUtils;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Schema(description = "管理后台 - 订单合同 Response VO")
@Data
@ExcelIgnoreUnannotated
public class OrderContractExportVO {

    private OrderDO orderDO;

    @Schema(description = "销售凭证")
    @ExcelProperty("销售凭证")
    private String vbeln;

    @Schema(description = "公司代码")
    @ExcelProperty("公司代码")
    private String bukrs;

    @Schema(description = "售达方")
    @ExcelProperty("售达方")
    private String kname;

    @Schema(description = "售达方编码")
    @ExcelProperty("售达方编码")
    private String kunnr;

    @Schema(description = "凭证日期")
    @ExcelProperty("凭证日期")
    private String audat;

    @Schema(description = "合同总金额")
    @ExcelProperty("合同总金额")
    private String totalMoney;

    @Schema(description = "销售部门")
    @ExcelProperty("销售部门")
    private String vkburt;

    @Schema(description = "业务员")
    @ExcelProperty("业务员")
    private String ywyt;

    @Schema(description = "凭证类型")
    @ExcelProperty("凭证类型")
    private String auartt;

    @Schema(description = "合同模板", example = "李四")
    @ExcelProperty("合同模板")
    private String contractTemplateName;

    @Schema(description = "合同管控类型")
    @ExcelProperty("合同管控类型")
    private String zzhtgklxms;

    @Schema(description = "付款条件")
    @ExcelProperty("付款条件")
    private String ztermt;

    @Schema(description = "销售组")
    @ExcelProperty("销售组")
    private String vkgrp;

    @Schema(description = "销售组名称")
    @ExcelProperty("销售组名称")
    private String vkgrpt;

    @Schema(description = "框架协议是否回收")
    @ExcelProperty("框架协议是否回收")
    private String frameworkAgreementId;

    @Schema(description = "下载次数", example = "18690")
    @ExcelProperty("下载次数")
    private Integer downloadCount;

    @Schema(description = "打印次数", example = "28392")
    @ExcelProperty("打印次数")
    private Integer printCount;

    @Schema(description = "原件是否上传")
    @ExcelProperty("原件是否上传")
    private String fileIds;

    @Schema(description = "扫描件是否上传")
    @ExcelProperty("扫描件是否上传")
    private String scanFileIds;

    @Schema(description = "合同生成状态", example = "1")
    @ExcelProperty(value = "合同生成状态", converter = DictConvert.class)
    @DictFormat("order_contract_generate_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String status;

    @Schema(description = "合同状态", example = "1")
    @ExcelProperty(value = "合同状态", converter = DictConvert.class)
    @DictFormat("order_contract_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String orderStatus;

    @Schema(description = "释放状态")
    @ExcelProperty(value = "释放状态", converter = DictConvert.class)
    @DictFormat("order_contract_push_release") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String isPushRelease;

    @Schema(description = "合同冻结状态")
    @ExcelProperty(value = "合同冻结状态", converter = DictConvert.class)
    @DictFormat("order_contract_freeze_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private String orderFreezeStatus;

    @Schema(description = "异常原因")
    @ExcelProperty("异常原因")
    private String abnormalCause;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    @ColumnWidth(20)
    private LocalDateTime createTime;
    public String getAudat() {
        if(getOrderDO()!=null){
            return getOrderDO().getAudat();
        }
        return audat;
    }

    public String getVbeln() {
        if(getOrderDO()!=null){
            return getOrderDO().getVbeln();
        }
        return vbeln;
    }

    public String getAuartt() {
        if(getOrderDO()!=null){
            return getOrderDO().getAuartt();
        }
        return auartt;
    }

    public String getZzhtgklxms() {
        if(getOrderDO()!=null){
            return getOrderDO().getZzhtgklxms();
        }
        return zzhtgklxms;
    }

    public String getZtermt() {
        if(getOrderDO()!=null){
            return getOrderDO().getZtermt();
        }
        return ztermt;
    }

    public String getBukrs() {
        if(getOrderDO()!=null){
            return getOrderDO().getBukrs();
        }
        return bukrs;
    }

    public String getKname() {
        if(getOrderDO()!=null){
            return getOrderDO().getKname();
        }
        return kname;
    }

    public String getKunnr() {
        if(getOrderDO()!=null){
            return getOrderDO().getKunnr();
        }
        return kunnr;
    }

    public String getVkburt() {
        if(getOrderDO()!=null){
            return getOrderDO().getVkburt();
        }
        return vkburt;
    }

    public String getVkgrp() {
        if(getOrderDO()!=null){
            return getOrderDO().getVkgrp();
        }
        return vkgrp;
    }

    public String getVkgrpt() {
        if(getOrderDO()!=null){
            return getOrderDO().getVkgrpt();
        }
        return vkgrpt;
    }

    public String getYwyt() {
        if(getOrderDO()!=null){
            return getOrderDO().getYwyt();
        }
        return ywyt;
    }

    public String getFileIds() {
        if(StringUtils.isBlank(fileIds)){
            return "否";
        }else{
            return "是";
        }
    }

    public String getScanFileIds() {
        if(StringUtils.isBlank(scanFileIds)){
            return "否";
        }else{
            return "是";
        }
    }

    public String getFrameworkAgreementId() {
        if(StringUtils.isBlank(frameworkAgreementId)){
            return "否";
        }else{
            return "是";
        }
    }

}